﻿@model LanguageModel
@{
    //page title
    ViewBag.Title = T("Admin.Configuration.Languages.EditLanguageDetails").Text;
}
<form asp-area="@Constants.AreaAdmin" asp-controller="Language" asp-action="Edit" method="post" >
    
    <div class="row">
        <div class="col-md-12">
            <div class="x_panel light form-fit">
                <div class="x_title">
                    <div class="caption">
                        <i class="fa fa-language"></i>
                        @T("Admin.Configuration.Languages.EditLanguageDetails") - @Model.Name
                        <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(T("Admin.Configuration.Languages.BackToList").Text, "List") </small>
                    </div>
                    <div class="actions">
                        <div class="btn-group btn-group-devided">
                            <button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @T("Admin.Common.Save") </button>
                            <button class="btn btn-success" type="submit" name="save-continue"><i class="fa fa-check-circle"></i> @T("Admin.Common.SaveContinue") </button>
                            <a href="@Url.Action("ExportXml", new { id = Model.Id })" class="btn blue">@T("Admin.Configuration.Languages.Export")</a>
                            <input type="button" id="importxml" class="btn yellow" value="@T("Admin.Configuration.Languages.Import")" />
                            <span id="language-delete" class="btn red"><i class="fa fa-trash-o"></i> @T("Admin.Common.Delete")</span>
                            <vc:admin-widget widget-zone="language_details_buttons" additional-data="Model" />
                        </div>
                    </div>
                </div>
                <div class="x_content form">
                   <partial name="_CreateOrUpdate" model="Model" />
                </div>
            </div>
        </div>
    </div>
</form>
<admin-delete-confirmation button-id="language-delete"/>

    @*import resources form*@
    <div class="modal-dialog" id="importxml-window" style="display:none; padding: 0 10px;">
        <form asp-area="@Constants.AreaAdmin" asp-controller="Language" asp-action="ImportXml" method="post" enctype="multipart/form-data" asp-route-id="Id">
            <input type="hidden" asp-for="Id" />
            
            <ul class="common-list">
                <li>
                    <strong>NOTE: It can take up to several minutes.</strong>
                </li>
                <li>
                    <strong>NOTE: DO NOT click twice.</strong>
                </li>
            </ul>
            <div class="form-group">
                <div class="col-md-2" style="margin-top: 7px; height: 34px; padding-left: 25px;">
                    <label class="control-label">
                        Xml file
                    </label>
                </div>
                <div class="col-md-10">
                    <input id="importxmlfile" name="importxmlfile" class="form-control" type="file">
                </div>
            </div>
            <div class="form-group">
                &nbsp;
            </div>
            <div class="form-group">
                <div class="col-md-2">
                    &nbsp;
                </div>
                <div class="col-md-10 text-right mt-10">
                    <input id="importxmlsubmit" class="btn blue" value="@T("Admin.Configuration.Languages.Import")" type="submit">
                </div>
            </div>
        </form>
    </div>
    <script>
    $(document).ready(function () {
        $("#importxml").click(function (e) {
            e.preventDefault();
            var window = $("#importxml-window");
            if (!window.data("kendoWindow")) {
                window.kendoWindow({
                    modal: true,
                    title: "@T("Admin.Configuration.Languages.Import")",
                    actions: ["Close"]
                });
            }
            window.data('kendoWindow').center().open();
        });
    });
    </script>
